<!DOCTYPE html>
<html lang="en" class="dark">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>PhpWebStudy</title>
  </head>
  <body>
    <div id="app"></div>
    <script type="module" src="./main.ts"></script>
    <script>
      window.addEventListener('message', event => {
        console.log('event: ', event)
        if (event?.data?.fun === 'AppSetTheme') {
          window?.AppSetTheme?.(event?.data?.value)
        } else if (event?.data?.fun === 'AppSetLang') {
          window?.AppSetLang?.(event?.data?.value)
        }
      });
      const check = () => {
        if (window?.AppSetTheme && window?.AppSetLang) {
          window?.parent?.postMessage('ready', '*')
        } else {
          setTimeout(check, 300)
        }
      }
      check()
    </script>
  </body>
</html>
